import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'color/MyColor.dart';

class FavListTitle extends StatelessWidget{
  FavListTitle({Key key, this.title,this.subTitle,this.url,this.onTap}) : super(key: key);
  final String title;
  final String subTitle;
  final String url;
  final GestureTapCallback onTap;
  @override
  Widget build(BuildContext context) {
    var width =  ScreenUtil.screenWidthDp;
    var height = 120.0;
    return Container(
      width: width,
      height: height,
      child: new GestureDetector(
        child: new Stack(
          children: <Widget>[
            new Container(
              margin: EdgeInsets.only(top:15,left: 15),
              width: 80,
              height: 105,
              child: Image.network(url, fit: BoxFit.cover),
            ),
            new Container(
              margin: EdgeInsets.only(top:25,left:110),
              child: Text(title),
            ),
            new Container(
              margin: EdgeInsets.only(top:55,left:110),
              child: Text(subTitle),
            ),
          ],
        ),
        onTap: onTap,
      ),
    );
  }
}
class HomeListTitle extends StatelessWidget{
  HomeListTitle({Key key, this.title,this.subTitle,this.url,this.onTap}) : super(key: key);
  final String title;
  final String subTitle;
  final String url;
  final GestureTapCallback onTap;
  @override
  Widget build(BuildContext context) {
    var width =  (ScreenUtil.screenWidthDp - 60)/3.0;
    return new Container(
      color: MyColor.AppFFFFFF,
      child: GestureDetector(
        onTap: onTap,
        child: new Column(
          children: <Widget>[
            new Container(
              width: width,
              height: width * 1.35,
              margin: EdgeInsets.only(left:0,right:0),
              child: Image.network(url, fit: BoxFit.cover),
            ),
            new Container(
              margin: EdgeInsets.only(top: 10),
              width: width,
              child: Text(title,maxLines: 1,textAlign: TextAlign.center,),
            ),
            new Container(
              margin: EdgeInsets.only(top:10,bottom: 0),
              width: width,
              child: Text(subTitle,maxLines: 1,textAlign: TextAlign.center,),
            ),
          ],
        ),
      ),

    );
  }
}

class ItemTitle extends StatelessWidget{
  ItemTitle({Key key, this.title,this.subTitle,this.url,this.nickName,this.lastChapter,this.onTap}) : super(key: key);
  final String title;
  final String subTitle;
  final String nickName;
  final String lastChapter;
  final String url;
  final GestureTapCallback onTap;
  @override
  Widget build(BuildContext context) {
    var width =  ScreenUtil.screenWidthDp;
    return new Container(
      color: MyColor.AppFFFFFF,
      width: width,
      child: GestureDetector(
        onTap: onTap,
        child: new Row(
          children: <Widget>[
            new Container(
              width: 80,
              height: 105,
              margin: EdgeInsets.only(left:15,top:15,bottom:15),
              child: Image.network(url, fit: BoxFit.cover),
            ),
            new Container(
              color: Colors.white,
              margin: EdgeInsets.only(left:10),
              width: width - 10 - 80 - 30,
              child: new Column(
                children: <Widget>[
                  new Container(
                    child: new Row(
                      children: <Widget>[
                        Text(title,maxLines: 1,textAlign: TextAlign.left,style:TextStyle(
                          color: MyColor.App000000,
                          fontSize: 17,
                        ),
                        ),
                      ],
                    ),
                  ),
                  new Container(
                    margin: EdgeInsets.only(top:10),
                    child: Text(subTitle,maxLines: 2,textAlign: TextAlign.left,style:TextStyle(
                      color: MyColor.App666666,
                      fontSize: 14,
                    )),
                  ),
                  new Container(
                    width: width - 10 - 80 - 30,
                    margin: EdgeInsets.only(top:10),
                    child: new Row(
                      children: <Widget>[
                        new Container(
                          child: Text(nickName,maxLines: 1,textAlign: TextAlign.left,style:TextStyle(
                            color: MyColor.AppColor,
                            fontSize: 12,
                          )),
                        ),
                        Expanded(child: Text(lastChapter,maxLines: 1,textAlign: TextAlign.right,style:TextStyle(
                          color: MyColor.App999999,
                          fontSize: 12,
                        )),)
//                        new Container(
//                          margin: EdgeInsets.only(left: 15),
//                          width: width/2,
//                          child: Text(lastChapter,maxLines: 1,textAlign: TextAlign.left,style:TextStyle(
//                            color: MyColor.App999999,
//                            fontSize: 12,
//                          )),
//                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),

    );
  }
}